<?php

namespace Wechat\Data;

use Wechat\Constants\EventConstants;

class FrameData extends BaseData
{
    protected $event;
    /**
     * @return mixed
     */
    public function getEvent()
    {
        return $this->event;
    }

    /**
     * @param mixed $event
     */
    public function setEvent($event): void
    {
        $this->event = $event;
    }

    protected $userId;

    /**
     * @return mixed
     */
    public function getUserId()
    {
        return $this->userId;
    }

    /**
     * @param mixed $userId
     */
    public function setUserId($userId): void
    {
        $this->userId = $userId;
    }

    protected $message;

    /**
     * @return mixed
     */
    public function getMessage()
    {
        return $this->message;
    }

    /**
     * @param mixed $message
     */
    public function setMessage($message): void
    {
        $this->message = $message;
    }

    public function __construct($data)
    {
        $this->setEvent($data['event']);
        $this->setUserId($data['userId']);
        $this->setMessage($data['message']);
    }

    public function isHeartBeat()
    {
        return $this->getEvent() == EventConstants::HEART_BEAT;
    }

}